package com.String;

import java.util.Scanner;

/*
判断小字符串在大字符串的位置
*/
public class Demo06 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个大的字符串：");
        String bigstr = sc.next();
        System.out.println("请输入一个小的字符串：");
        String smallstr = sc.next();
        String[] arr = bigstr.split(",");
        int count = 0;
        System.out.println("出现的索引位置：");
        for (int i = 0; i < arr.length; i++) {
            if (arr[i].contains(smallstr)) {
                count++;
                System.out.print(i+",");
            }
        }
        System.out.println();
        System.out.println("小字符串在大字符串出现" + count + "次！");
    }
}
